<?php
class Custom_Application_Resource_Locale
    extends Zend_Application_Resource_ResourceAbstract
{
    protected $_locale;

    public function init()
    {
        if (null === $this->_locale) {
            $options = $this->getOptions();

            $session = new Zend_Session_Namespace('locale');
            if (!isset($session->name)){
                $session->name = $options['default'];
            }

            $this->_locale = new Zend_Locale($session->name);
            Zend_Registry::set('Zend_Locale', $this->_locale);
        }
        return $this->_locale;
    }
}